package com.android.kotlincoroutinemvvmdemo
import android.app.Application
import android.content.Context
import android.content.res.Configuration
import android.util.Log
import com.android.kotlincoroutinemvvmdemo.hook.HookNotificationManager

class CoroutineMVVMApp : Application() {

    override fun attachBaseContext(base: Context?) {
        super.attachBaseContext(base)
        base?.let {
            HookNotificationManager.hook(it)
        }
    }

    override fun onCreate() {
        super.onCreate()
        instance = this
        Log.d(Constants.TAG, "CoroutineMVVMApp---override fun onCreate()")
    }

    fun isDarkTheme(): Boolean {
        return (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES
    }

    companion object {
        @JvmStatic
        var instance: CoroutineMVVMApp? = null
            private set
    }
}